<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         function sum(a,b=1){//默认参数，一定要放到后面
             return a+b;
         }
         
         console.log(sum(1));//2
         console.log(sum(1,5));//6

         function count(money,dcount=0,ddcoun=0){
             return money*(1-dcount)**(1-ddcoun);
         }

         console.log(count(1000));
         console.log(Math.round(count(1000,0.1,0.1)));


         //模块化编程
        //   function filter_item(a){
        //       return  a>3;
        //   }
        //   let arr=[1,2,23,82,851,2].filter(filter_item);
        //   console.log(arr);


        //arguments参数
        function sum(){
            console.log([...arguments]);//[1,2,5,4]
        }
        console.log(sum(1,2,5,4));//Arguments(4) [1, 2, 5, 4, callee: ƒ, Symbol(Symbol.iterator): ƒ]
        //也是相当于一个默认的数组，所以还是点语法好用

    </script>
</body>
</html>